<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title>代理商添加</title>

	<link rel="stylesheet" href="/scriptZIP/layui.min.css">
	<link rel="stylesheet" href="/css/common2.css">
	<link rel="stylesheet" href="/css/layui.css" />
	
	<link rel="stylesheet" href="/scriptZIP/vue-select.min.css">
	<style>
		.layui-row {
			margin-top: 50px;
		}
	</style>
</head>

<body>
	
	<form class="layui-form" id="vue-root">
		<div class="layui-row" ref="veefrom">
			<div class="layui-col-md6 layui-col-md-offset3">
				<div class="layui-form-item">
					<label class="layui-form-label">分组名称</label>
					<div class="layui-input-block">
						<input name="agent" v-validate="'required|min:2'" autocomplete="off" placeholder="请输入学校分组名称"
							class="layui-input name" v-model="item.name" data-vv-as="名称">
						<div class="checkout_state" v-text="err('agent')"></div>
					</div>
				</div>


				<div class="layui-form-item">
					<label class="layui-form-label">添加学校分组</label>
					<div class="layui-input-block">
						<v-select multiple placeholder="请选择学校" label="name" :options="agents" :reduce="item=>item.id"
							v-model="item.schoolIds"></v-select>
					</div>
				</div>


				<div class="layui-form-item">
					<div class="layui-input-block">
						<input type="button" class="offer" value="立即提交" @click="submit">
						<div class="return" onclick="history.back()" style="margin-top: 0 !important;">取消</div>
					</div>
				</div>
			</div>
		</div>
	</form>

	<script src="/scriptZIP/qs.min.js"></script>
	<script src="/scriptZIP/vue.min.js"></script>
	
	
	<script src="/scriptZIP/axios.min.js"></script>
	<script src="/scriptZIP/vue-select.min.js"></script>

	<script src="/js/common.js"></script>
	<script src="/js/item.js"></script>

	<script>
		Vue.component('v-select', VueSelect.VueSelect);
        var agentId= top_params().id;
		var app = new Vue(merge({
			data: {
				url: '/pc/schoolGroup',
				item: {
					schoolIds: [],
                    agentId:agentId
				},
				agents: [],
			},
			created: function () {
				axios.get('/pc/school/all/'+agentId).then(function (res) {
					this.agents = res.data;
					this.item.agentIds = this.agents.map(function (it) {
						return it.id;
					});
				}.bind(this));
				this.init();
			},
			methods: {

			}
		}));
	</script>
</body>

</html>